class clusters::limits inherits clusters {

  if $allowlimits { 
      limits::limits { 'user_rss':
      ensure     => present,
      user       => '*',
      limit_type => 'rss',
      hard       => "${maxmemory}",
      }

      limits::limits { 'user_as':
      ensure     => present,
      user       => '*',
      limit_type => 'as',
      hard       => "${vritual_memory}",
      }

      limits::limits { 'user_nproc':
      ensure     => present,
      user       => '*',
      limit_type => 'nproc',
      hard       => "${maxproc}",
      }
  }
  else {
      limits::limits { 'user_rss':
      ensure     => absent,
      user       => '*',
      limit_type => 'rss',
      }

      limits::limits { 'user_as':
      ensure     => absent,
      user       => '*',
      limit_type => 'rss',
      }

      limits::limits { 'user_nproc':
      ensure     => absent,
      user       => '*',
      limit_type => 'rss',
      }
  }
  limits::limits { 'user_nofile':
  ensure     => present,
  user       => '*',
  limit_type => 'nofile',
  soft       => "${nofile}",
  hard       => "${nofile}",
  }
}
